<?php


namespace App\Listener;


use Swoft\Event\Annotation\Mapping\Listener;
use Swoft\Event\EventHandlerInterface;
use Swoft\Event\EventInterface;
use Swoft\Server\SwooleEvent;


/**
 * Class MyRegisterServer
 * @package App\Listener
 * @Listener(event=SwooleEvent::START)
 */
class MyRegisterServer implements EventHandlerInterface
{

    public function handle(EventInterface $event): void
    {
        //var_dump('注册服务');
        sgo(function (){
           $config = bean('config')->get('provider.consul');
           bean('consulProvider')->registerServer($config);
        });
    }
}
